<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*当作用域，递归，for-in相遇，一个精彩的故事就发生了*/

    var obj = {a:1,b:[2,3]};
    var dst = {};
    function deepClone(oldOne) {
        for(i in oldOne){
            console.log(i);
            if(oldOne[i].constructor == Array){
                deepClone(oldOne[i]);
            }else {
                dst[i] = oldOne[i];
            }
        }
        return dst;
    }
    console.log(deepClone(obj));
</script>
</body>
</html>